﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Dominio.Entidades;
using Util;

/// <summary>
/// Summary description for JornadaVerano_BLL
/// </summary>
 namespace Dominio.Negocio
{
     public class JornadaVerano_BLL : Disposable
    {
         VacacionesDataContext db = new VacacionesDataContext();
         bool _disposed;

         public List<JornadaVerano> DiasJornadaVerano(int anyo) 
         {

             return db.JornadaVeranos.Where(c => c.Anyo == anyo).ToList();
             /*(from c in db.JornadaVeranos
                                                                            where c.Anyo == anyo
                                                                            select c).ToList();*/
            
         }

         public int GuardaJornadaVerano(DateTime dia, int anyo)
         {
             var resul = db.P_InsertaJornadaVerano(dia, anyo);
             if (resul==1)
                 db.SubmitChanges();
             return resul;
         }

         #region Métodos sobreescritos
         /// <summary>
         /// Método sobrecargado de Dispose que será el que
         /// libera los recursos, controla que solo se ejecute
         /// dicha lógica una vez y evita que el GC tenga que
         /// llamar al destructor de clase.
         /// </summary>
         /// <param name=”bool”></param>
         protected override void Dispose(bool disposing)
         {
             if (_disposed)
                 return;

             if (disposing)
             {
                 // free other managed objects that implement
                 // IDisposable only
                 if (db != null)
                     db.Dispose();
             }

             // release any unmanaged objects
             // set the object references to null

             _disposed = true;
         }
         #endregion
    }
}